perm filename BIN[0,BGB]3 blob sn#102642 filedate 1974-05-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00006 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	4.0	A Polyhedron Intersection Algorithm.
C00003 00003	4.0	Introduction to Polyhedron Intersection.
C00004 00004	4.1	Intersection Geometry.
C00005 00005	FIXUP1
C00008 00006
C00011 ENDMK
C⊗;
4.0	A Polyhedron Intersection Algorithm.

	4.0	Introduction.
	4.1	Intersection Geometry.
	4.2	2-D Partition Sort of Faces, Edges and Vertices.
	4.3	Intersection Topology.
	4.4	Performance.
	4.5	Nasty Special Cases.

4.0	Introduction to Polyhedron Intersection.

	The polyhderon intersection algorithm consists  of two parts:
first there is a  geometric part in which all the faces and edges are
compared with each other for potential intersections and second there
is a  topological part in  which the desired resultant  polyhedron is
copied  off of the given  polyhedra. (The result  may consist of more
than one polyhedron).

4.1	Intersection Geometry.

	The geometric part of the polyhedron intersection algorithm
consists of two routines. One routine determines whether a given
edge passes through a given face and the second routine creates a vertex
at the locus where an edge pierces a face.

4.2	The 2-D Partition Sort of Faces, Edges and Vertices.

COMMENT	FIXUP1

	FIXUP1 places vertex and wing pointers in all the non-surface
edges. A non-surface  edge is distinguished by its non-zero ALT link,
and the new vertices are provided with a A as a first edge,  PED, if
it be lacking.;

	A←BODY0;
WHILE (A←PED(A)) ≠ BODY0 DO IF (E←ALT(A))≠0 THEN
BEGIN
	PVT(A)	←V←	ALT(PVT(E)); IF PED(V)=0 THEN PED(V)←A;
	NVT(A)	←V←	ALT(NVT(E)); IF PED(V)=0 THEN PED(V)←A;
	NCW(A)	←	ALT(NCW(E));
	PCW(A)	←	ALT(PCW(E));
	NCCW(A)	←	ALT(NCCW(E));
	PCCW(A)	←	ALT(PCCW(E));
END;

COMMENT FIXUP2

	FIXUP2 wigns together  the surface vertex  tridedral corners.
Since it  is our good luck that  all surface vertices are necessarily
trihedral, the edges can be passed to the WING primitive for oriented
linking, in  any order.   The two surface  wings of a  surface vertex
were  stored in the NED and PED links  by MKSURF; the inward wing can
be retrieve as the PED(ALT(U)). Surface vertices are distinguished by
their ALT vertex having his SURBIT on.;

COMMENT FIXUP3

	FIXUP3  replaces the  alein  faces of  the  result body  with
native  faces; this  is done by  scaning the  edge ring of  the body,
testing the  two faces of  each edge  to see  if they  belong to  the
result body,  and if a  face doesn't belong it  is replaced by  a new
one.  Face replacement,  as ususal,  requires clocking around  a face
perimeter and changing the appropriate face link in each edge.